package com.huawang.mdesign.model.service.constant;

import lombok.Getter;

import java.util.Arrays;

/**
 * 模型属性合并单一属性处理规则
 */
@Getter
public enum SinglePropertyMergeRuleEnum {
    REMAIN_SOURCE_PROPERTY_VALUE(1, "保留当前元素属性"),
    USE_TARGET_PROPERTY_VALUE_REPLACE(2, "用目标元素属性替换");
    private final int code;
    private final String desc;

    SinglePropertyMergeRuleEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static boolean isSinglePropertyMergeRule(Integer code) {
        return code != null && Arrays.stream(values()).anyMatch(e -> e.getCode() == code);
    }

}
